{include file="public/head"}
<script src="__JS__/jquery.js" type="text/javascript" charset="utf-8"></script>
<!--2.模块化使用-->
<script src="__STATIC__/dist/layui.all.js" type="text/javascript" charset="utf-8"></script>

<body>
	<div class="x-body">
		<!--<form class="lotus-nav">-->
		<div class="lotus-nav">
			<div class="layui-input-inline">
				<input id="keyword" name="keyword" class="layui-input lotus-input" placeholder="请输入关键词搜索" value="{$keyword}">
			</div>
			<div class="layui-input-inline">
				<input id="begin" name="begin" class="layui-input lotus-input" placeholder="开始时间" value="{$Request.param.begin}">
			</div>
			<div class="layui-input-inline">
				<input id="end" name="end" class="layui-input lotus-input" placeholder="结束时间" value="{$Request.param.end}">
			</div>
			<button class="layui-btn layui-btn-sm" onclick="search()"><i class="layui-icon layui-icon-search"></i></button>

			<button class="layui-btn layui-btn-sm" onclick="downExcel()">导出</button>
			<span class="x-right">共有数据:<i class="i_count">{$data->total()}</i>条 <button onclick="javascript:location.reload()" class="layui-btn-default "><i class="layui-icon layui-icon-refresh"></i></button></span>
		</div>
		<!--</form>-->
		<table class="layui-table">
			<thead>
				<tr>
					<th>序号</th>
					<th>手机号</th>
					<th>用户名</th>
					<th>会员卡号</th>
					<th>卡级名称</th>
					<th>兑换券</th>
					<th>促销单号</th>
					<th>扣减积分</th>
					<th>赠券号</th>
					<th>领取状态</th>
					<th>领券时间</th>
			</thead>
			<tbody>
				{foreach $data as $key => $vo}
				<tr>
					<td>{$key+1}</td>
					<td>{$vo.mobile}</td>
					<td>{$vo.username}</td>
					<td>{$vo.cardHyNo}</td>
					<td>{$vo.cardLevel}</td>
					<td>{$vo.coupon_name}</td>
					<td>{$vo.promotion_num}</td>
					<td>{$vo.point}</td>
					<td>{$vo.certino}</td>
					<td>
						{if($vo.status)}
							成功
						{else/}
							失败
						{/if}
					</td>
					<td>{$vo.gettime}</td>
				</tr>
				{/foreach}
			</tbody>
		</table>
		<div class="page">
			<div>
				{$data|raw}
			</div>
		</div>
	</div>
</body>
<script>
	layui.use('layer', function() { //独立版的layer无需执行这一句
		var $ = layui.jquery,
			layer = layui.layer; //独立版的layer无需执行这一句
		var laydate = layui.laydate,
			upload = layui.upload;

		//执行一个laydate实例
		laydate.render({
			elem: '#begin' //指定元素
				,
			type: 'date'
		});
		//执行一个laydate实例
		laydate.render({
			elem: '#end' //指定元素
				,
			type: 'date'
		});

	});

	function search() {
		var keyword = $('#keyword').val();
		var begin = $('#begin').val();
		var end = $('#end').val();

		var urls = "/admin/Stat/exchange/keyword/" + keyword + "/begin/" + begin + '/end/' + end;
		console.log(urls)
		window.location = urls;
	}
	//导出
	function downExcel() {
		var keyword = $('#keyword').val();
		var begin = $('#begin').val();
		var end = $('#end').val();

		var urls = "/admin/Outexcel/downExcelExchange/keyword/" + keyword + "/begin/" + begin + '/end/' + end;
		console.log('urls', urls)
		window.location = urls;
	}
	//数组排序
	function compare(a, b) {
		if(a < b) {
			return -1;
		}
		if(a > b) {
			return 1;
		}
		// a = b
		return 0;
	}
</script>
{include file="public/foot"}